<?php

/**
 * Moyen form base class.
 *
 * @method Moyen getObject() Returns the current form's model object
 *
 * @package    mercure
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseMoyenForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idmoyen'               => new sfWidgetFormInputHidden(),
      'id_ce'                 => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Personnes'), 'add_empty' => true)),
      'idmoyen_a_pour_parent' => new sfWidgetFormInputText(),
      'idtypemoy'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TypeMoyen'), 'add_empty' => false)),
      'idetat'                => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Etat'), 'add_empty' => true)),
      'idlocalisation'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Localisation'), 'add_empty' => true)),
      'libelle'               => new sfWidgetFormInputText(),
      'indicatifradio'        => new sfWidgetFormInputText(),
      'commentaire'           => new sfWidgetFormTextarea(),
      'fonctionce'            => new sfWidgetFormInputText(),
      'created_at'            => new sfWidgetFormDateTime(),
      'updated_at'            => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'idmoyen'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idmoyen')), 'empty_value' => $this->getObject()->get('idmoyen'), 'required' => false)),
      'id_ce'                 => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Personnes'), 'required' => false)),
      'idmoyen_a_pour_parent' => new sfValidatorInteger(array('required' => false)),
      'idtypemoy'             => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('TypeMoyen'))),
      'idetat'                => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Etat'), 'required' => false)),
      'idlocalisation'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Localisation'), 'required' => false)),
      'libelle'               => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'indicatifradio'        => new sfValidatorString(array('max_length' => 30, 'required' => false)),
      'commentaire'           => new sfValidatorString(array('max_length' => 1000, 'required' => false)),
      'fonctionce'            => new sfValidatorString(array('max_length' => 128, 'required' => false)),
      'created_at'            => new sfValidatorDateTime(),
      'updated_at'            => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('moyen[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Moyen';
  }

}
